package com.test.ssss;

import java.util.concurrent.Callable;

public class www {
    private static int count = 0;
    private static final Object lock = new Object();


    public static void main(String[] args) {
     /*   a a = new a();
        b b = new b();
        Thread even = new Thread(a);
        Thread odd = new Thread(b);
        even.start();
        odd.start();*/
        System.out.println(7&1);
        System.out.println(7>>1);

        System.out.println(7%2);
        System.out.println(7/2);
    }

    static class a implements Runnable {

        @Override
        public void run() {
            while (count < 100) {
                synchronized (lock) {
                    // 只处理偶数
                    if ((count & 1) == 0) {
                        System.out.println(Thread.currentThread().getName() + ": " + count++);
                    }
                }
            }
        }
    }

    static class b implements Runnable {


        @Override
        public void run() {
            while (count < 100) {
                synchronized (lock) {
                    // 只处理奇数
                    if ((count & 1) == 1) {
                        System.out.println(Thread.currentThread().getName() + ": " + count++);
                    }
                }
            }
        }
    }
}
